#include <iostream>
#include <fstream>

#include "yaml-cpp/yaml.h"

using namespace std;

int main(int argc, char const *argv[])
{
    cout << "start" << endl;
    std::string map_yaml_file = "/home/sjl/git_ws/HelloStudy/cpp/yaml/20220705_1.yaml";

    YAML::Node map_yaml;
    try
    {
        map_yaml = YAML::LoadFile(map_yaml_file);
    }
    catch (const std::exception &e)
    {
        printf("load map %s yaml file error: %s", map_yaml_file.c_str(), e.what());
        return -1;
    }

    cout << map_yaml["image"].as<std::string>() << endl;
    cout << map_yaml["resolution"].as<double>() << endl;
    // cout << map_yaml["origin"].as<std::vector<double>>() << endl;
    cout << map_yaml["negate"].as<int>() << endl;
    cout << map_yaml["occupied_thresh"].as<double>() << endl;
    cout << map_yaml["free_thresh"].as<double>() << endl;

    return 0;
}